﻿namespace TestProject
{
    using System;
    using Swiss;

    public class Setup : IDirty
    {
        #region IDirty Members

        public event OnChange DoChange;

        object IDirty.CompareAndSetDirty(object prop, object value)
        {
            if (!prop.Equals(value))
            {
                if (DoChange != null)
                {
                    DoChange();
                }
            }

            return value;
        }

        #endregion IDirty Members

        private Object CompareAndSetDirty(Object prop, Object value)
        {
            return ((IDirty)this).CompareAndSetDirty(prop, value);
        }

        #region Properties

        //Visible when reflecting
        private string fS = "The Quick Brown Fox";
        [Swiss.Section("Test")]
        public String S
        {
            get { return fS; }
            set { fS = (String)CompareAndSetDirty(fS, value); }
        }

        #endregion Properties

        public Setup()
        {
            //Nothing
        }

    }
}
